package frontend;
import javax.swing.JTabbedPane;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import dbmanager.AccountManager;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class NomGUI extends javax.swing.JFrame {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private JTabbedPane mainTabbedPane;
	private FoodItemGUI FoodItemGUI;
	private SettingsGUI SettingsGUI;
	private RecipeGUI RecipeGUI;
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				NomGUI inst = new NomGUI();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public NomGUI() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			getContentPane().setBackground(new java.awt.Color(255,255,255));
			this.setResizable(false);
			this.setTitle("NOM - " + AccountManager.getLogin().getName() + " (" + AccountManager.getLogin().getUsername() + ")");
			this.addWindowListener(new WindowAdapter() {
				public void windowClosed(WindowEvent evt) {
					thisWindowClosed(evt);
				}
			});
			{
				mainTabbedPane = new JTabbedPane();
				getContentPane().add(mainTabbedPane);
				mainTabbedPane.setBounds(0, 0, 1024, 768);
				mainTabbedPane.setBackground(new java.awt.Color(255,255,255));
				mainTabbedPane.setTabPlacement(JTabbedPane.LEFT);
				{
					RecipeGUI = new RecipeGUI();
					mainTabbedPane.addTab("<html><b><br>Recipes<br></b></html>", null, RecipeGUI, null);
					RecipeGUI.setPreferredSize(new java.awt.Dimension(968, 734));
					FoodItemGUI = new FoodItemGUI();
					mainTabbedPane.addTab("<html><b><br>Food<br></b></html", null, FoodItemGUI, null);
					FoodItemGUI.setPreferredSize(new java.awt.Dimension(968, 734));
					FoodItemGUI.setLocation(new java.awt.Point(0, 50));
					SettingsGUI = new SettingsGUI();
					mainTabbedPane.addTab("<html><b><br>Settings<br></b></html", null, SettingsGUI, null);
					
				}
			}
			pack();
			this.setSize(1024, 768);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private void thisWindowClosed(WindowEvent evt) {
		System.exit(0);
	}

}
